<!--  -->
<template>
  <div>
    <ETable v-bind="tableConifg">
      <template #buttons="{ delAll }">
        <el-button type="primary" @click="add()">添加</el-button>
        <el-button type="danger" @click="delAll">批量删除</el-button>
      </template>

      <template #operation="{ row, del }">
        <el-button link type="primary" @click="edit(row.id)">修改</el-button>
        <el-button link type="danger" @click="del(row.id)">删除</el-button>
      </template>
 
    </ETable>
  </div>
</template>

<script lang="ts" setup>
import { reactive, toRefs, ref, onMounted } from "vue";
import ETable, { TableType } from "../../components/ETable.vue";
import { getElderlyList, delElderly, delElderlys } from "../../apis/elderly/elderly";

const imgUrl=import.meta.env.VITE_IMG_URL;

const tableConifg: TableType = {
  loadData: getElderlyList,
  columns: [
    { prop: "id", label: "序号" },
    { prop: "photo", label: "头像",imgPreview:true},
    { prop: "name", label: "老人姓名" },
    { prop: "operation", slot: true, label: "操作", width: "200" },
  ],
  delelte: delElderly,
  delelteAll: delElderlys,
  isSearch: false,
};


const edit = (id: number) => {
  alert(id);
};
const add = () => {
  alert("add");
};
</script>
<style scoped></style>
